package initialize

import (
	"github.com/Meng-Xin/logger"
	"github.com/gin-gonic/gin"
	"ylm.sl/global"
	"ylm.sl/internal/router"
)

func routerInit() *gin.Engine {
	r := gin.Default()
	allRouter := router.AllRouter

	// 链路追踪日志中间件
	r.Use(logger.GinMiddleware(global.Log, "link"))
	// admin
	admin := r.Group("/api/short-link/admin/v1")
	{
		allRouter.UserRouter.InitApiRouter(admin)
		allRouter.GroupRouter.InitApiRouter(admin)
	}

	project := r.Group("/api/short-link/v1")
	{
		allRouter.ShortLinkRouter.InitApiRouter(project)
	}
	return r
}
